﻿using System.Windows.Forms;
using Common.Logging;
using NKnife.ControlKnife.Kit.Forms;
using NKnife.Interface;
using NKnife.IoC;
using NKnife.Wrapper;
using WeifenLuo.WinFormsUI.Docking;

namespace NKnife.ControlKnife.Kit
{
    public sealed partial class LibraryDemoWorkbench : Form
    {
        private static readonly ILog _logger = LogManager.GetLogger<LibraryDemoWorkbench>();
        private DockPanel _DockPanel;

        public LibraryDemoWorkbench()
        {
            InitializeComponent();
            DockPanelManager();
            MenuItemClickEventManager();
            Text = $"{Text} - {DI.Get<IAbout>().AssemblyVersion}";
            _logger.Info($"{Name}-{GetType().Name}");
        }

        private void DockPanelManager()
        {
            _DockPanel = new DockPanel
            {
                Dock = DockStyle.Fill,
                Theme = new VS2015DarkTheme()
            };
            Controls.Add(_DockPanel);
            _DockPanel.BringToFront();
        }

        private void MenuItemClickEventManager()
        {
            _CustomStripControlTestMenuItem.Click += (s, e) =>
            {
                var form = DI.Get<CustomStripControlTestDockView>();
                form.Show(_DockPanel, DockState.Document);
            };
            _ImagesPanelMenuItem.Click += (s, e) =>
            {
                var form = DI.Get<ImagesPanelControlTestDockView>();
                form.Show(_DockPanel, DockState.Document);
            };
        }

        private void 颜色选择器ToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            var dialog = new Colors.ColorPickerDialog();
            dialog.ShowDialog(this);
            MessageBox.Show($"{dialog.SelectedColor}");
        }
    }

    public class CurrentAbout : About
    {
    }
}